# -*- coding:utf-8 -*-

__author__ = 'stevezhou'

import qywechat_sdk

if __name__ == '__main__':
    # CORPID = "wx6b7b3270008d7aee" # 企业号的corpid
    # CORPSECRET = "fgp7GIQ8SjElYxluRJeIphhXFCWR9_xTgEHn14jmVPl80lmepmJ4TjO7n3V9U5wf" #企业号的corpsecret
    #
    # #开启回调模式需要设定的参数
    # TOKEN = "dgtRHTvWO4bahEyMQRBBP5wFYD4syA"
    # ENCODINGAESKEY = "VnEuWYjbgUpql3sD9OKykOmYzoDE1ONCG2V1lYak3Kw"
    
    wx = qywechat_sdk.WeChatEnterprise(corpid="wx6b7b3270008d7aee", corpsecret="fgp7GIQ8SjElYxluRJeIphhXFCWR9_xTgEHn14jmVPl80lmepmJ4TjO7n3V9U5wf", agentid=2)
    # res = wx.get_department_list()
    
    #status, res = wx.send_msg_to_user("tests", touser=['zhoub'])
    
    #print res
    
    # filepath = "/home/stevezhou/tmp/eroad.jpg"
    # f = open(filepath, 'rb')
    # status, res = wx.upload_media("image", f)
    # print status, res
    #False {u'media_id': u'1GGaWMkIliPRRoPW_v-GbzNPAqQcar2nbx1GS7dQ6e4rdOdcE5kIwqEO5i3_i4vNc', u'created_at': 1431750465, u'type': u'image'}
    
    kwarg = {"media_id": '1GGaWMkIliPRRoPW_v-GbzNPAqQcar2nbx1GS7dQ6e4rdOdcE5kIwqEO5i3_i4vNc'}
    status, res = wx.send_msg_to_user('test from py', touser=['zhoub'], msgtype='image', **kwarg)
    
    print res

